package com.lcg.springboot.controller;


import com.lcg.springboot.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

//@Controller //springmvc原始注解

@RestController // @RestController=@Controller + @ResponseBody
public class UserController {



    @RequestMapping("/user")
   // @ResponseBody
    public User getUser(){

        User u =new User();
        u.setName("张三");
        u.setAge(18);
        u.setBirthday(new Date());
        u.setPassword("1234");
        u.setDesc("这是一个张三User");

        return u;
        //{"name":"张三","age":18,"birthday":"2020-02-04 04:37:17","desc":"这是一个张三User"}
    }

    @RequestMapping("/user1")
    // @ResponseBody
    public User getUser1(){

        User u =new User();
        u.setName("张三");
        u.setAge(18);
        u.setBirthday(new Date());
        u.setPassword("1234");

        return u;

        //{"name":"张三","age":18,"birthday":"2020-02-04 04:36:52"}
    }


}
